﻿<%@ WebHandler Language="C#" Class="GetInfo" %>

using System;
using System.Web;
using System.Data;

public class GetInfo : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        
        string strResult = "";
        DataTable dtResult = new DataTable();
        string action = context.Request.QueryString["action"];
        string userid = context.Request.QueryString["userid"] != null ? context.Request.QueryString["userid"] : "";
        switch (action)
        {
            case "department":
                DataSet dsList = new BLL.T_PublicDepartment().GetList(0, "", " DepartMentLevel ");
                if (dsList != null)
                    if (dsList.Tables.Count > 0)
                        if (dsList.Tables[0].Rows.Count > 0)
                        {
                            dtResult = dsList.Tables[0];
                        }
                break;
        }
        if (dtResult.Rows.Count > 0)
        {
            ReturnMsg rm = new ReturnMsg();
            rm.retcode = 0;
            rm.remark = "获取成功！";
            rm.retdatatable = dtResult;
            rm.retjson = "";
            strResult = rm.retdata;
        }
        else
        {
            ReturnMsg rm = new ReturnMsg();
            rm.retcode = 1;
            rm.remark = "数据不存在！";
            rm.retdatatable = null;
            rm.retjson = "[]";
            strResult = rm.retdata;
        }
        context.Response.Write(strResult);
        context.Response.End(); 
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}